home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Frameworks / Hsoi's App Shell 1.0a4 / HAS Other Source / WASTE 1.3a4 Distribution / WASTE 1.3a4 / Private Includes / WASTEIntf.h < prev   
Encoding:
Text File  |  1997-04-16  |  64.1 KB  |  1,522 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    WASTEIntf.h
  3.  *
  4.  *    WASTE PROJECT
  5.  *  Internal (private) interface, version 1.3a4
  6.  *
  7.  *  Copyright (c) 1993-1997 Marco Piovanelli
  8.  *    All Rights Reserved
  9.  *
  10.  *  C port by Dan Crevier
  11.  *
  12.  */
  13.  
  14. //    Toolbox #includes
  15.  
  16. #ifndef __CONDITIONALMACROS__
  17. #include <ConditionalMacros.h>
  18. #endif
  19.  
  20. #ifndef UNIVERSAL_INTERFACES_VERSION
  21. #error "You need Universal Headers version 2.1 or newer to compile WASTE"
  22. #endif
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31.  
  32. #ifndef __CODEFRAGMENTS__
  33. #include <CodeFragments.h>
  34. #endif
  35.  
  36. #ifndef __ERRORS__
  37. #include <Errors.h>
  38. #endif
  39.  
  40. #ifndef __GESTALT__
  41. #include <Gestalt.h>
  42. #endif
  43.  
  44. #ifndef __MEMORY__
  45. #include <Memory.h>
  46. #endif
  47.  
  48. #ifndef __FONTS__
  49. #include <Fonts.h>
  50. #endif
  51.  
  52. #ifndef __QUICKDRAWTEXT__
  53. #include <QuickdrawText.h>
  54. #endif
  55.  
  56. #ifndef __QUICKDRAW__
  57. #include <Quickdraw.h>
  58. #endif
  59.  
  60. #ifndef __QDOFFSCREEN__
  61. #include <QDOffscreen.h>
  62. #endif
  63.  
  64. #ifndef __PALETTES__
  65. #include <Palettes.h>
  66. #endif
  67.  
  68. #ifndef __TEXTEDIT__
  69. #include <TextEdit.h>
  70. #endif
  71.  
  72. #ifndef __SCRAP__
  73. #include <Scrap.h>
  74. #endif
  75.  
  76. #ifndef __SCRIPT__
  77. #include <Script.h>
  78. #endif
  79.  
  80. #ifndef __TOOLUTILS__
  81. #include <ToolUtils.h>
  82. #endif
  83.  
  84. #ifndef __TEXTUTILS__
  85. #include <TextUtils.h>
  86. #endif
  87.  
  88. #ifndef __LOWMEM__
  89. #include <LowMem.h>
  90. #endif
  91.  
  92. #ifndef __APPLEEVENTS__
  93. #include <AppleEvents.h>
  94. #endif
  95.  
  96. #ifndef __AEREGISTRY__
  97. #include <AERegistry.h>
  98. #endif
  99.  
  100. #ifndef __DRAG__
  101. #include <Drag.h>
  102. #endif
  103.  
  104. #ifndef __TEXTSERVICES__
  105. #include <TextServices.h>
  106. #endif
  107.  
  108. //    ANSI #includes
  109.  
  110. #ifndef _LIMITS
  111. #include <limits.h>
  112. #endif
  113.  
  114. //    other #includes
  115.  
  116. #ifndef __LONGCOORDINATES__
  117. #ifndef _LongCoords_
  118. #include "LongCoords.h"
  119. #endif
  120. #endif
  121.  
  122. // MPW needs topLeft and botRight defined here
  123. #ifndef topLeft
  124. #define topLeft(r)                      (((Point *) &(r))[0])
  125. #endif
  126.  
  127. #ifndef botRight
  128. #define botRight(r)                     (((Point *) &(r))[1])
  129. #endif
  130.  
  131. // pascal-like macros for testing, setting, clearing and inverting bits
  132. #define BTST( FLAGS, BIT )                ((FLAGS) &   (1L << (BIT)))
  133. #define BSET( FLAGS, BIT )              ((FLAGS) |=  (1L << (BIT)))
  134. #define BCLR( FLAGS, BIT )              ((FLAGS) &= ~(1L << (BIT)))
  135. #define BCHG( FLAGS, BIT )              ((FLAGS) ^=  (1L << (BIT)))
  136.  
  137. // pascal-like macros for shifting bits
  138. #define BSL( A, B )                        (((SInt32) (A)) << (B))
  139. #define BSR( A, B )                        (((SInt32) (A)) >> (B))
  140.  
  141. // macros used in conjunction with the styleRunPosition parameter
  142. #define IS_LEFTMOST_RUN(RUN)            ((RUN) <= leftStyleRun)
  143. #define IS_RIGHTMOST_RUN(RUN)            (! ((RUN) & 0x01))
  144.  
  145. // other macros
  146. #define ABS(A)                             ((A) > 0 ? (A) : -(A))
  147. #define BLOCK_CLR(X)                    _WEBlockClr(&(X), sizeof(X));
  148.  
  149. // define WASTE_VERSION is standard NumVersion format
  150.  
  151. #define WASTE_VERSION                    0x01304004    /* 1.3a4 */
  152.  
  153. // set WASTE_SHARED_LIBRARY to 1 when building a CFM-based shared library
  154. #ifndef WASTE_SHARED_LIBRARY
  155. #define WASTE_SHARED_LIBRARY            0
  156. #endif
  157.  
  158. //    make sure WASTE_SHARED_LIBRARY is false if building a non-CFM project
  159. #if ( WASTE_SHARED_LIBRARY && ( ! GENERATINGCFM ) )
  160. #error "WASTE_SHARED_LIBRARY must be 0 in a classic 68K project"
  161. #endif
  162.  
  163. // set WASTE_DEBUG to 1 to perform various consistency checks;
  164. // errors will be reported with DebugStr()
  165. // WARNING: when WASTE_DEBUG is set, WEIdle() calls can be extremely time-consuming
  166. #ifndef WASTE_DEBUG
  167. #define WASTE_DEBUG                        0
  168. #endif
  169.  
  170. // set WASTE_OBJECTS to 0 if you don't need embedded objects
  171. #ifndef WASTE_OBJECTS
  172. #define    WASTE_OBJECTS                    1
  173. #endif
  174.  
  175. // set WASTE_USE_UPPS to 0 if you don't need UPPs
  176. #ifndef WASTE_USE_UPPS
  177. #define WASTE_USE_UPPS                    GENERATINGCFM
  178. #endif
  179.  
  180. // set WASTE_REDRAW_SPEED to 1 to use Mark Alldritt's optimizations of _WERedraw
  181. #ifndef WASTE_REDRAW_SPEED
  182. #define WASTE_REDRAW_SPEED                0
  183. #endif
  184.  
  185. // set WASTE_NO_SYNCH to 1 if you don't want WASTE to synchronize keyboard and fonts
  186. #ifndef WASTE_NO_SYNCH
  187. #define WASTE_NO_SYNCH                    0
  188. #endif
  189.  
  190. // set WASTE_NO_RO_CARET to 1 to hide the caret in read-only mode
  191. #ifndef WASTE_NO_RO_CARET
  192. #define WASTE_NO_RO_CARET                1
  193. #endif
  194.  
  195. // set WASTE_IC_SUPPORT to 1 to use Dan Crevier's
  196. // support of URL cmd-clicking through Internet Config
  197. #ifndef WASTE_IC_SUPPORT
  198. #define WASTE_IC_SUPPORT                1
  199. #endif
  200.  
  201. // If WASTE_OBJECTS_ARE_GLYPHS is set to 0 (default), WEGetOffset returns kObjectEdge in
  202. // the edge parameter when thePoint is in the middle half of an object: as a result,
  203. // clicking in the middle of an object immediately _selects_ the object, so that a second
  204. // click immediately following triggers the 'clik' callback (this can be handy to make
  205. // sound objects play when they are double-clicked, for example).
  206.  
  207. // If WASTE_OBJECTS_ARE_GLYPHS is set to 1, WEGetOffset treats embedded objects
  208. // like ordinary glyphs and never returns kObjectEdge in the edge parameter:
  209. // as a result, clicking in the middle of an object always positions the caret either
  210. // to the left or to the right of the object.
  211.  
  212. #ifndef WASTE_OBJECTS_ARE_GLYPHS
  213. #define WASTE_OBJECTS_ARE_GLYPHS        0
  214. #endif
  215.  
  216. // set WASTE_RESOLVE_FONT_DESIGNATORS to false if you don't want WASTE to
  217. // map font designators (the special IDs 0 and 1 that identify the system
  218. // and application fonts, respectively) to the actual font IDs.
  219.  
  220. #ifndef WASTE_RESOLVE_FONT_DESIGNATORS
  221. #define WASTE_RESOLVE_FONT_DESIGNATORS    1
  222. #endif
  223.  
  224. // set WASTE_WECALTEXT_DOES_REDRAW to 1 if you want WECalText()
  225. // to automatically redraw all the text (as in WASTE 1.1 final)
  226.  
  227. #ifndef WASTE_WECALTEXT_DOES_REDRAW
  228. #define WASTE_WECALTEXT_DOES_REDRAW        0
  229. #endif
  230.  
  231. // set WASTE_KURTHS_OPTION_ARROWS to 0 to use the old
  232. // implementation of option + left/right arrow combinations, which is
  233. // less conformant to Apple's HIGs than the current implementation,
  234. // due to Stefan Kurth
  235.  
  236. #ifndef WASTE_KURTHS_OPTION_ARROWS
  237. #define WASTE_KURTHS_OPTION_ARROWS        1
  238. #endif
  239.  
  240. // set WASTE_TRANSLUCENT_DRAGS to 1 if you want to be able to
  241. // use translucent dragging for text
  242.  
  243. #ifndef WASTE_TRANSLUCENT_DRAGS
  244. #define WASTE_TRANSLUCENT_DRAGS            0
  245. #endif
  246.  
  247. // macros for debugging
  248.  
  249. #if WASTE_DEBUG
  250. #define WEASSERT(CONDITION, WARNING)    { if (!(CONDITION)) DebugStr(WARNING); }
  251. #else
  252. #define WEASSERT(CONDITION, WARNING)
  253. #endif
  254.  
  255. // determine if inline functions are supported
  256.  
  257. #if defined(__cplusplus) || defined(__MWERKS__)
  258. #define INLINE inline
  259. #else
  260. #define INLINE static
  261. #endif
  262.  
  263. // result codes
  264. enum
  265. {
  266.     weCantUndoErr                =    -10015,    // undo buffer is clear (= errAECantUndo)
  267.     weEmptySelectionErr            =    -10013,    // selection range is empty (= errAENoUserSelection)
  268.     weUnknownObjectTypeErr        =    -9478,    // specified object type is not registered
  269.     weObjectNotFoundErr            =    -9477,    // no object found at specified offset
  270.     weReadOnlyErr                =    -9476,    // instance is read-only
  271.     weMonoStyledErr                =    -9475,    // instance is mono-styled
  272.     weNotHandledErr                =    -1708,  // please use default handling (= errAEEventNotHandled)
  273.     weNewerVersionErr            =    -1706,    // need a newer version of WASTE (= errAENewerVersion)
  274.     weCorruptDataErr            =    -1702,    // corrupt data (= errAECorruptData)
  275.     weProtocolErr                =    -603,    // improper call order (= protocolErr)
  276.     weUndefinedSelectorErr        =    -50,    // unknown selector
  277.     weNoDragErr                 =     128        // can be returned internally by _WEDrag
  278. };
  279.  
  280. // values for WEInstallObjectHandler handlerSelector parameter
  281. enum
  282. {
  283.     weNewHandler         =     'new ',
  284.     weDisposeHandler     =     'free',
  285.     weDrawHandler         =     'draw',
  286.     weClickHandler         =     'clik',
  287.     weStreamHandler        =    'strm'
  288. };
  289.  
  290. // action kinds
  291. enum
  292. {
  293.     weAKNone            =    0,        // null action
  294.     weAKUnspecified        =    1,        // action of unspecified nature
  295.     weAKTyping            =    2,        // some text has been typed in
  296.     weAKCut                =    3,        // the selection range has been cut
  297.     weAKPaste            =    4,        // something has been pasted
  298.     weAKClear            =    5,        // the selection range has been deleted
  299.     weAKDrag            =    6,        // drag and drop operation
  300.     weAKSetStyle        =    7        // some style has been applied to a text range
  301. };
  302.  
  303. // action flags
  304. enum
  305. {
  306.     weAFIsRedo            =    0x0001,    // action saves edit state prior to a WEUndo call
  307.     weAFDontSaveText    =    0x0002, // don't save text
  308.     weAFDontSaveStyles    =    0x0004,    // don't save styles
  309.     weAFDontSaveSoup    =    0x0008    // don't save soup
  310. };
  311.  
  312. // destination kinds for streaming objects
  313. enum
  314. {
  315.     weToScrap            =    0,
  316.     weToDrag            =    1,
  317.     weToSoup            =    2
  318. };
  319.  
  320. // alignment styles
  321. enum
  322. {
  323.     weFlushLeft         =    -2,        // flush left
  324.     weFlushRight        =    -1,        // flush right
  325.     weFlushDefault        =     0,        // flush according to system direction
  326.     weCenter            =     1,        // centered
  327.     weJustify            =     2        // fully justified
  328. };
  329.  
  330. // dominant line directions
  331. enum
  332. {
  333.     weDirRightToLeft    =    -1,        // right-to-left
  334.     weDirLeftToRight    =     0,        // left-to-right
  335.     weDirDefault        =     1        // according to system direction
  336. };
  337.  
  338. #define IsRightToLeft(direction)    (((direction) == weDirRightToLeft) || (((direction) == weDirDefault) && (GetSysDirection() != 0)))
  339.  
  340. // values for the edge parameter
  341. enum
  342. {
  343.     kLeadingEdge         =     -1,        // point is on the leading edge of a glyph
  344.     kTrailingEdge         =      0,        // point is on the trailing edge of a glyph
  345.     kObjectEdge         =      2        // point is inside an embedded object
  346. };
  347.  
  348. // control character codes
  349. enum
  350. {
  351.     kObjectMarker         =    0x01,
  352.     kBackspace             =    0x08,
  353.     kTab                 =    0x09,
  354.     kEOL                 =    0x0D,
  355.     kArrowLeft             =    0x1C,
  356.     kArrowRight         =    0x1D,
  357.     kArrowUp             =    0x1E,
  358.     kArrowDown             =    0x1F,
  359.     kSpace                 =      0x20,
  360.     kForwardDelete         =    0x7F
  361. };
  362.  
  363. // bit equates for the tsFlags field of the WETextStyle record
  364. enum
  365. {
  366.     tsTSMHilite         =    4,        // set if style run is part of active input area
  367.     tsTSMSelected         =    5,        // set for selected raw/converted text
  368.     tsTSMConverted         =    6,        // set for converted text, clear for raw text
  369.     tsRightToLeft         =    7        // set for right-to-left runs
  370. };
  371.  
  372. // bit equates for the mode parameter in WESetStyle and WEContinuousStyle
  373. enum
  374. {
  375.     kModeFont             =    0,        // change font
  376.     kModeFace             =    1,        // change Quickdraw styles
  377.     kModeSize             =    2,        // change point size
  378.     kModeColor             =    3,        // change color
  379.     kModeAddSize         =    4,        // add tsSize to existing size
  380.     kModeToggleFace     =    5,        // toggle continuous styles rather than setting them
  381.     kModeReplaceFace     =    6,        // tsFace replaces existing styles outright
  382.     kModePreserveScript =    7,        // apply font to runs of same script only
  383.     kModeExtractSubscript = 8,        // apply font to eligible subruns of different script
  384.     kModeFaceMask         =     9,        // change Quickdraw styles; use mask
  385.     kModeObject         =     14,        // change tsObject field
  386.     kModeFlags             =     15        // change tsFlags field
  387. };
  388.  
  389. // values for the mode parameter in WESetStyle and WEContinuousStyle
  390. enum
  391. {
  392.     weDoFont                =    1 << kModeFont,
  393.     weDoFace                =    1 << kModeFace,
  394.     weDoSize                =    1 << kModeSize,
  395.     weDoColor                =    1 << kModeColor,
  396.     weDoAll                    =    weDoFont + weDoFace + weDoSize + weDoColor,
  397.     weDoAddSize                =    1 << kModeAddSize,
  398.     weDoToggleFace            =    1 << kModeToggleFace,
  399.     weDoReplaceFace            =    1 << kModeReplaceFace,
  400.     weDoPreserveScript        =    1 << kModePreserveScript,
  401.     weDoSmartFont            =    weDoFont + weDoPreserveScript,
  402.     weDoExtractSubscript    =    1 << kModeExtractSubscript,
  403.     weDoFaceMask            =    1 << kModeFaceMask,
  404.     weDoObject                =    1 << kModeObject,
  405.     weDoFlags                =    1 << kModeFlags
  406. };
  407.  
  408. // values for WEFeatureFlag action parameter
  409. enum
  410. {
  411.     weBitSet             =     1,        // enables the specified feature
  412.     weBitClear             =     0,        // disables the specified feature
  413.     weBitTest             =    -1,        // returns the current setting of the specified feature
  414.     weBitToggle         =    -2        // toggles the specified feature
  415. };
  416.  
  417. // bit equates for the flags field in the WE record
  418. enum
  419. {
  420.     weFHasColorQD             =    31,        // Color Quickdraw is available
  421.     weFHasDragManager         =    30,        // the Drag Manager is available
  422.     weFHasTextServices        =    29,        // the Text Services Manager is available
  423.     weFNonRoman                =    28,        // at least one non-Roman script is enabled
  424.     weFDoubleByte            =    27,        // a double-byte script is enabled
  425.     weFBidirectional        =    26,        // a bidirectional script is enabled
  426.     weFCaretRight            =    25,        // set if caret was drawn for R-L keyboard script
  427.     weFCaretVisible            =    24,        // the caret is currently visible
  428.     weFMouseTracking        =    23,        // set internally during mouse tracking
  429.     weFAnchorIsEnd            =    22,        // anchor offset is selEnd
  430.     weFUseNullStyle            =    21,        // a null style is associated with the empty selection
  431.     weFActive                =    20,        // we're active
  432.     weFHilited                =    19,        // true if text pane is highlighted (for Drag & Drop)
  433.     weFCanAcceptDrag        =    18,        // the drag in the text pane can be accepted
  434.     weFDragCaretVisible        =    17,        // drag caret is currently visible
  435.     weFDestRectChanged        =    16,        // set if scroll callback needs to be called
  436.     weFHasTranslucentDrags    =    15,        // SetDragImage is available
  437.     weFAccumulateUndos        =    14        // don't clear undo stack before new change
  438. };
  439.  
  440. // bit equates for the features field in the WE record
  441. enum
  442. {
  443.     weFInhibitColor        =    31,        // draw in black & white only; ignore color
  444.     weFMonoStyled        =    13,        // disallow style changes
  445.     weFInhibitRedraw    =    12,        // don't redraw text
  446.     weFDrawOffscreen    =    11,        // draw text offscreen for smoother visual results
  447.     weFUseTempMem        =    10,        // use temporary memory for main data structures
  448.     weFInhibitRecal        =     9,        // don't recalculate line breaks and don't redraw text
  449.     weFDragAndDrop        =     8,        // support drag and drop
  450.     weFIntCutAndPaste    =     7,        // intelligent cut & paste
  451.     weFUndoSupport        =     6,        // support undo/redo
  452.     weFReadOnly            =     5,        // disallow editing
  453.     weFOutlineHilite    =     2,        // frame selection range when text pane is inactive
  454.     weFAutoScroll        =     0        // automatically scroll text when cursor is outside pane
  455. };
  456.  
  457. // scrap types
  458. enum
  459. {
  460.     kTypeText            =    'TEXT',
  461.     kTypeStyles         =    'styl',
  462.     kTypeSoup             =    'SOUP'
  463. };
  464.  
  465. // selectors for WEGetInfo/WESetInfo
  466. enum
  467. {
  468.     weCharByteHook            =    'cbyt',
  469.     weCharTypeHook            =    'ctyp',
  470.     weCharToPixelHook        =    'c2p ',
  471.     weClickLoop                =    'clik',
  472.     weCurrentDrag            =    'drag',
  473.     weDrawTextHook            =    'draw',
  474.     weEraseHook                =    'eras',
  475.     weFluxProc                =    'flux',
  476.     weHiliteDropAreaHook    =    'hidr',
  477.     weLineArray                =    'line',
  478.     weLineBreakHook            =    'lbrk',
  479.     wePixelToCharHook        =    'p2c ',
  480.     wePort                    =    'port',
  481.     weRefCon                =    'refc',
  482.     weRunArray                =    'runa',
  483.     weScrollProc            =    'scrl',
  484.     weStyleTable            =    'styl',
  485.     weText                    =    'text',
  486.     weTranslateDragHook        =    'xdrg',
  487.     weTranslucencyThreshold    =    'tluc',
  488.     weTSMDocumentID            =    'tsmd',
  489.     weTSMPostUpdate            =    'post',
  490.     weTSMPreUpdate            =    'pre ',
  491.     weURLHint                =    'urlh',
  492.     weWordBreakHook            =    'wbrk'
  493. };
  494.  
  495. // possible values returned by WEIntelligentPaste
  496. enum
  497. {
  498.     weDontAddSpaces            =     0,
  499.     weAddSpaceOnLeftSide    =    -1,
  500.     weAddSpaceOnRightSide    =     1
  501. };
  502.  
  503. // values for WEAllocate allocFlags parameter
  504. enum
  505. {
  506.     kAllocClear            =    0x00000001,    // clear handle after allocation
  507.     kAllocTemp            =    0x00000002    // use temporary memory if available
  508. };
  509.  
  510. // other miscellaneous constants
  511. enum
  512. {
  513.     kCaretWidth = 1,            // width of the caret, in pixels
  514.     kMinFontSize = 1,            // minimum valid font size
  515.     kMaxFontSize = SHRT_MAX,    // maximum valid font size
  516.     kInvalidOffset = -1,         // used to flag an invalid or nonexistent offset
  517.     kUnknownObjectType = -1,    // returned by _WELookupObjectType for unknown flavors
  518.     kNullDrag = 0,                // null or nonexistent drag reference
  519.     kTextMargin = 3,            // width of border area surrounding the text (in pixels)
  520.     kMaxScrollDelta = 30,        // maximum scroll amount used by standard click loop
  521.     kAutoScrollDelay = 10,        // delay before auto-scroll starts (in ticks)
  522.     kDefaultObjectHeight = 32,    // default height for new objects
  523.     kDefaultObjectWidth = 32,    // default width for new objects
  524.     kAutoOrderingSize = 32        // size of stack-based format array used by _WESegmentLoop
  525. };
  526.  
  527. #if PRAGMA_ALIGN_SUPPORTED
  528. #pragma options align=mac68k
  529. #endif
  530.  
  531. typedef UInt16 WEStyleMode;
  532. typedef SInt8 WEAlignment;
  533. typedef SInt16 WEDirection;
  534. typedef SInt8 WEEdge;
  535. typedef SInt16 WEActionKind;
  536. typedef UInt16 WEActionFlags;
  537.  
  538. // forward declarations
  539.  
  540. typedef struct WERec *WEPtr, **WEHandle;
  541. typedef struct WEObjectDesc **WEObjectDescHandle;
  542.  
  543. typedef struct WETextStyle
  544. {
  545.     SInt16 tsFont;                    // font family number
  546.     Style tsFace;                    // set of Quickdraw styles
  547.     UInt8 tsFlags;                    // flags (FOR INTERNAL USE ONLY)
  548.     SInt16 tsSize;                    // font size, in integer points
  549.     RGBColor tsColor;                // absolute red-green-blue color
  550. #if WASTE_OBJECTS
  551.     WEObjectDescHandle tsObject;    // embedded object reference
  552. #endif
  553. } WETextStyle;
  554.  
  555. typedef struct WERunAttributes
  556. {
  557.     SInt16 runHeight;            // style run height (ascent + descent + leading)
  558.     SInt16 runAscent;            // font ascent
  559.     WETextStyle runStyle;        // text style
  560. } WERunAttributes;
  561.  
  562. typedef struct WERunInfo
  563. {
  564.     SInt32 runStart;            // byte offset to first character of this style run
  565.     SInt32 runEnd;                // byte offset to first character of next style run
  566.     WERunAttributes runAttrs;    // run attributes
  567. } WERunInfo;
  568.  
  569. typedef struct QDEnvironment
  570. {
  571.     GrafPtr envPort;
  572.     PenState envPen;
  573.     WETextStyle envStyle;
  574.     SInt16 envMode;
  575. } QDEnvironment;
  576.  
  577. typedef struct WERunArrayEntry
  578. {
  579.     SInt32 runStart;            // offset to first character in style run
  580.     SInt32 styleIndex;            // index into style table
  581. } WERunArrayEntry, **WERunArrayHandle;
  582.  
  583. typedef struct TERunAttributes
  584. {
  585.     SInt16 runHeight;
  586.     SInt16 runAscent;
  587.     TextStyle runTEStyle;
  588. } TERunAttributes;
  589.  
  590. typedef struct TEStyleScrapElement
  591. {
  592.     SInt32 scrpStartChar;
  593.     TERunAttributes scrpTEAttrs;
  594. } TEStyleScrapElement;
  595.  
  596. typedef struct TEStyleScrap
  597. {
  598.     SInt16 scrpNStyles;
  599.     TEStyleScrapElement scrpStyleTab[ kVariableLengthArray ];
  600. } TEStyleScrap, **TEStyleScrapHandle;
  601.  
  602. typedef struct WEStyleTableEntry
  603. {
  604.     SInt32 refCount;            // reference count
  605.     WERunAttributes info;        // style information
  606. } WEStyleTableEntry, **WEStyleTableHandle;
  607.  
  608. typedef struct WELineRec
  609. {
  610.     SInt32 lineStart;            // byte offset to first character in line
  611.     SInt32 lineOrigin;            // pixel offset from destRect.top
  612.     SInt16 lineAscent;            // maximum font ascent for this line
  613.     SInt16 lineSlop;            // extra pixels needed to fill up the line
  614.     Fixed lineJustAmount;        // normalized slop value, used for justification
  615. } WELineRec, **WELineArrayHandle;
  616.  
  617. typedef struct WEAction
  618. {
  619.     WEHandle hOwner;            // handle to associated WE instance
  620.     struct WEAction **hNext;    // used to keep a linked list of actions
  621.     Handle hText;                // handle to saved text
  622.     Handle hStyles;                // handle to saved styles
  623.     Handle hSoup;                // handle to saved soup
  624.     SInt32 delRangeStart;        // start of range to delete
  625.     SInt32 delRangeLength;        // length of range to delete
  626.     SInt32 insRangeLength;        // lenfth of range to insert
  627.     SInt32 hiliteStart;            // start of range to hilite
  628.     SInt32 hiliteEnd;            // end of range to hilite
  629.     WEActionKind actionKind;    // identifies event that caused this action to be pushed
  630.     WEActionFlags actionFlags;    // miscellaneous flags
  631. } WEAction, **WEActionHandle;
  632.  
  633. // A WESoup record is a static description of an object embedded in the text.
  634. // The 'SOUP' data type is just a collection of WESoup records, each followed
  635. // by the corresponding object data.
  636. // This data type complements the standard TEXT/styl pair.
  637.  
  638. typedef struct WESoup
  639. {
  640.     SInt32 soupOffset;            // insertion offset for this object
  641.     FlavorType soupType;        // 4-letter tag identifying object type
  642.     SInt32 soupReserved1;        // reserved for future use; set to zero
  643.     Size soupDataSize;            // size of object data following this record
  644.     Point soupSize;                // object height and width, in pixels
  645.     SInt32 soupReserved2;        // reserved for future use; set to zero
  646. } WESoup;
  647.  
  648. // callback prototypes
  649.  
  650. typedef pascal Boolean (*WEClickLoopProcPtr)(WEHandle hWE);
  651. typedef pascal void (*WEScrollProcPtr)(WEHandle hWE);
  652. typedef pascal void (*WETSMPreUpdateProcPtr)(WEHandle hWE);
  653. typedef pascal void (*WETSMPostUpdateProcPtr)(WEHandle hWE,
  654.         SInt32 fixLength, SInt32 inputAreaStart, SInt32 inputAreaEnd,
  655.         SInt32 pinRangeStart, SInt32 pinRangeEnd);
  656. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference drag,
  657.         ItemReference dragItem, FlavorType requestedType, Handle putDataHere,
  658.         SInt32 dropOffset, WEHandle hWE);
  659. typedef pascal OSErr (*WEHiliteDropAreaProcPtr)(DragReference drag,
  660.         Boolean hiliteFlag, WEHandle hWE);
  661. typedef pascal OSErr (*WEFontIDToNameProcPtr)(SInt16 fontID, Str255 fontName);
  662. typedef pascal OSErr (*WEFontNameToIDProcPtr)(ConstStr255Param fontName, SInt16 oldFontID, SInt16 *newFontID);
  663. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  664.         JustStyleCode styleRunPosition, WEHandle hWE);
  665. typedef pascal SInt32 (*WEPixelToCharProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  666.         Fixed *pixelWidth, WEEdge *edge, JustStyleCode styleRunPosition, Fixed hPos, WEHandle hWE);
  667. typedef pascal SInt16 (*WECharToPixelProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  668.         SInt32 offset, SInt16 direction, JustStyleCode styleRunPosition, SInt16 hPos, WEHandle hWE);
  669. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, SInt32 textLength,
  670.         SInt32 textStart, SInt32 textEnd, Fixed *textWidth, SInt32 *textOffset, WEHandle hWE);
  671. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, SInt16 textLength, SInt16 offset,
  672.         WEEdge edge, OffsetTable breakOffsets, ScriptCode script, WEHandle hWE);
  673. typedef pascal SInt16 (*WECharByteProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script,
  674.         WEHandle hWE);
  675. typedef pascal SInt16 (*WECharTypeProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script, WEHandle hWE);
  676. typedef pascal void (*WEEraseProcPtr)(const Rect *area, WEHandle hWE);
  677. typedef pascal void (*WEFluxProcPtr)(SInt32 offset, SInt32 delta, WEHandle hWE);
  678. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  679.         WEObjectDescHandle hObjectDesc);
  680. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectDescHandle hObjectDesc);
  681. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  682.         WEObjectDescHandle hObjectDesc);
  683. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  684.         WEObjectDescHandle hObjectDesc);
  685. typedef pascal OSErr (*WEStreamObjectProcPtr)(SInt16 destKind, FlavorType *theType, Handle putDataHere, WEObjectDescHandle hObjectDesc);
  686.  
  687.  
  688. // UPP proc info
  689.  
  690. enum
  691. {
  692.     uppWEClickLoopProcInfo = kPascalStackBased
  693.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  694.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  695.     uppWEScrollProcInfo = kPascalStackBased
  696.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  697.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  698.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  699.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  700.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  701.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*fixLength*/)))
  702.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*inputAreaStart*/)))
  703.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*inputAreaEnd*/)))
  704.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*pinRangeStart*/)))
  705.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 /*pinRangeEnd*/))),
  706.     uppWETranslateDragProcInfo = kPascalStackBased
  707.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  708.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  709.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*dragItem*/)))
  710.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  711.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  712.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*dropOffset*/)))
  713.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  714.     uppWEHiliteDropAreaProcInfo = kPascalStackBased
  715.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  716.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  717.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(Boolean /*hiliteFlag*/)))
  718.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  719.     uppWEFontIDToNameProcInfo = kPascalStackBased
  720.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  721.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt16 /*fontID*/)))
  722.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(StringPtr /*fontName*/))),
  723.     uppWEFontNameToIDProcInfo = kPascalStackBased
  724.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  725.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(ConstStr255Param /*fontName*/)))
  726.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*oldFontID*/)))
  727.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 * /*newFontID*/))),
  728.     uppWEDrawTextProcInfo = kPascalStackBased
  729.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  730.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  731.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  732.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  733.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  734.     uppWEPixelToCharProcInfo = kPascalStackBased
  735.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt32)))
  736.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  737.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  738.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  739.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  740.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEEdge * /*edge*/)))
  741.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  742.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  743.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  744.     uppWECharToPixelProcInfo = kPascalStackBased
  745.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  746.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  747.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  748.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  749.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  750.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt16 /*direction*/)))
  751.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  752.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(SInt16 /*hPos*/)))
  753.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  754.     uppWELineBreakProcInfo = kPascalStackBased
  755.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  756.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  757.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  758.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*textStart*/)))
  759.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*textEnd*/)))
  760.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  761.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 * /*textOffset*/)))
  762.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  763.     uppWEWordBreakProcInfo = kPascalStackBased
  764.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  765.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textLength*/)))
  766.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 /*offset*/)))
  767.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEEdge /*edge*/)))
  768.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  769.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  770.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  771.     uppWECharByteProcInfo = kPascalStackBased
  772.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  773.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  774.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  775.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  776.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  777.     uppWECharTypeProcInfo = kPascalStackBased
  778.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  779.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  780.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  781.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  782.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  783.     uppWEEraseProcInfo = kPascalStackBased
  784.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*area*/)))
  785.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  786.     uppWEFluxProcInfo = kPascalStackBased
  787.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  788.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*delta*/)))
  789.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  790.     uppWENewObjectProcInfo = kPascalStackBased
  791.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  792.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  793.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  794.     uppWEDisposeObjectProcInfo = kPascalStackBased
  795.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  796.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  797.     uppWEDrawObjectProcInfo = kPascalStackBased
  798.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  799.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  800.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  801.     uppWEClickObjectProcInfo = kPascalStackBased
  802.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  803.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  804.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*modifiers*/)))
  805.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(UInt32 /*clickTime*/)))
  806.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  807.     uppWEStreamObjectProcInfo = kPascalStackBased
  808.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  809.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16 /*destKind*/)))
  810.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FlavorType * /*theType*/)))
  811.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  812.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  813. };
  814.  
  815.  
  816. /*    UPPs, New≈Proc macros & Call≈Proc macros */
  817.  
  818. /*
  819.     NOTE:
  820.     For compatibility with the Pascal version, Call≈Proc macros take the form:
  821.  
  822.         CallFooProc(..., userRoutine)
  823.  
  824.     instead of:
  825.  
  826.         CallFooProc(userRoutine, ...)
  827.  
  828. */
  829.  
  830. #if WASTE_USE_UPPS
  831.  
  832. typedef UniversalProcPtr WEClickLoopUPP;
  833. typedef UniversalProcPtr WEScrollUPP;
  834. typedef UniversalProcPtr WETSMPreUpdateUPP;
  835. typedef UniversalProcPtr WETSMPostUpdateUPP;
  836. typedef UniversalProcPtr WETranslateDragUPP;
  837. typedef UniversalProcPtr WEHiliteDropAreaUPP;
  838. typedef UniversalProcPtr WEFontIDToNameUPP;
  839. typedef UniversalProcPtr WEFontNameToIDUPP;
  840. typedef UniversalProcPtr WEDrawTextUPP;
  841. typedef UniversalProcPtr WEPixelToCharUPP;
  842. typedef UniversalProcPtr WECharToPixelUPP;
  843. typedef UniversalProcPtr WELineBreakUPP;
  844. typedef UniversalProcPtr WEWordBreakUPP;
  845. typedef UniversalProcPtr WECharByteUPP;
  846. typedef UniversalProcPtr WECharTypeUPP;
  847. typedef UniversalProcPtr WEEraseUPP;
  848. typedef UniversalProcPtr WEFluxUPP;
  849. typedef UniversalProcPtr WENewObjectUPP;
  850. typedef UniversalProcPtr WEDisposeObjectUPP;
  851. typedef UniversalProcPtr WEDrawObjectUPP;
  852. typedef UniversalProcPtr WEClickObjectUPP;
  853. typedef UniversalProcPtr WEStreamObjectUPP;
  854.  
  855. #define NewWEClickLoopProc(userRoutine) \
  856.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  857. #define NewWEScrollProc(userRoutine) \
  858.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  859. #define NewWETSMPreUpdateProc(userRoutine) \
  860.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  861. #define NewWETSMPostUpdateProc(userRoutine) \
  862.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  863. #define NewWETranslateDragProc(userRoutine) \
  864.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  865. #define NewWEHiliteDropAreaProc(userRoutine) \
  866.     (WEHiliteDropAreaUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEHiliteDropAreaProcInfo, GetCurrentArchitecture())
  867. #define NewWEFontIDToNameProc(userRoutine) \
  868.     (WEFontIDToNameUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontIDToNameProcInfo, GetCurrentArchitecture())
  869. #define NewWEFontNameToIDProc(userRoutine) \
  870.     (WEFontNameToIDUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontNameToIDProcInfo, GetCurrentArchitecture())
  871. #define NewWEDrawTextProc(userRoutine) \
  872.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  873. #define NewWEPixelToCharProc(userRoutine) \
  874.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  875. #define NewWECharToPixelProc(userRoutine) \
  876.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  877. #define NewWELineBreakProc(userRoutine) \
  878.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  879. #define NewWEWordBreakProc(userRoutine) \
  880.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  881. #define NewWECharByteProc(userRoutine) \
  882.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  883. #define NewWECharTypeProc(userRoutine) \
  884.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  885. #define NewWEEraseProc(userRoutine) \
  886.     (WEEraseUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEEraseProcInfo, GetCurrentArchitecture())
  887. #define NewWEFluxProc(userRoutine) \
  888.     (WEFluxUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFluxProcInfo, GetCurrentArchitecture())
  889. #define NewWENewObjectProc(userRoutine) \
  890.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  891. #define NewWEDisposeObjectProc(userRoutine) \
  892.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  893. #define NewWEDrawObjectProc(userRoutine) \
  894.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  895. #define NewWEClickObjectProc(userRoutine) \
  896.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  897. #define NewWEStreamObjectProc(userRoutine) \
  898.     (WEStreamObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEStreamObjectProcInfo, GetCurrentArchitecture())
  899.  
  900. #define CallWEClickLoopProc(hWE, userRoutine) \
  901.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (hWE))
  902. #define CallWEScrollProc(hWE, userRoutine) \
  903.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (hWE))
  904. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  905.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (hWE))
  906. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  907.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  908. #define CallWETranslateDragProc(drag, dragItem, requestedType, putDataHere, dropOffset, hWE, userRoutine) \
  909.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (drag), (dragItem), (requestedType), (putDataHere), (dropOffset), (hWE))
  910. #define CallWEHiliteDropAreaProc(drag, hiliteFlag, hWE, userRoutine) \
  911.     CallUniversalProc((userRoutine), uppWEHiliteDropAreaProcInfo, (drag), (hiliteFlag), (hWE))
  912. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  913.     CallUniversalProc((userRoutine), uppWEFontIDToNameProcInfo, (fontID), (fontName))
  914. #define CallWEFontNameToIDProc(fontName, oldFontID, fontID, userRoutine) \
  915.     CallUniversalProc((userRoutine), uppWEFontNameToIDProcInfo, (fontName), (oldFontID), (fontID))
  916. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  917.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (hWE))
  918. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  919.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  920. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  921.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  922. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  923.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  924. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  925.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  926. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  927.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (hWE))
  928. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  929.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (hWE))
  930. #define CallWEEraseProc(area, hWE, userRoutine) \
  931.     CallUniversalProc((userRoutine), uppWEEraseProcInfo, (area), (hWE))
  932. #define CallWEFluxProc(offset, delta, hWE, userRoutine) \
  933.     CallUniversalProc((userRoutine), uppWEFluxProcInfo, (offset), (delta), (hWE))
  934. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) \
  935.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (hObjectDesc))
  936. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) \
  937.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (hObjectDesc))
  938. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) \
  939.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (hObjectDesc))
  940. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) \
  941.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (hObjectDesc))
  942. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) \
  943.     CallUniversalProc((userRoutine), uppWEStreamObjectProcInfo, (destKind), (theType), (putDataHere), (hObjectDesc))
  944.  
  945. #else
  946.  
  947. typedef WEClickLoopProcPtr WEClickLoopUPP;
  948. typedef WEScrollProcPtr WEScrollUPP;
  949. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  950. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  951. typedef WETranslateDragProcPtr WETranslateDragUPP;
  952. typedef WEHiliteDropAreaProcPtr WEHiliteDropAreaUPP;
  953. typedef WEFontIDToNameProcPtr WEFontIDToNameUPP;
  954. typedef WEFontNameToIDProcPtr WEFontNameToIDUPP;
  955. typedef WEDrawTextProcPtr WEDrawTextUPP;
  956. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  957. typedef WECharToPixelProcPtr WECharToPixelUPP;
  958. typedef WELineBreakProcPtr WELineBreakUPP;
  959. typedef WEWordBreakProcPtr WEWordBreakUPP;
  960. typedef WECharByteProcPtr WECharByteUPP;
  961. typedef WECharTypeProcPtr WECharTypeUPP;
  962. typedef WEEraseProcPtr WEEraseUPP;
  963. typedef WEFluxProcPtr WEFluxUPP;
  964. typedef WENewObjectProcPtr WENewObjectUPP;
  965. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  966. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  967. typedef WEClickObjectProcPtr WEClickObjectUPP;
  968. typedef WEStreamObjectProcPtr WEStreamObjectUPP;
  969.  
  970. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  971. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  972. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  973. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  974. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  975. #define NewWEHiliteDropAreaProc(userRoutine) ((WEHiliteDropAreaUPP) (userRoutine))
  976. #define NewWEFontIDToNameProc(userRoutine) ((WEFontIDToNameUPP) (userRoutine))
  977. #define NewWEFontNameToIDProc(userRoutine) ((WEFontNameToIDUPP) (userRoutine))
  978. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  979. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  980. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  981. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  982. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  983. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  984. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  985. #define NewWEEraseProc(userRoutine) ((WEEraseUPP) (userRoutine))
  986. #define NewWEFluxProc(userRoutine) ((WEFluxUPP) (userRoutine))
  987. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  988. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  989. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  990. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  991. #define NewWEStreamObjectProc(userRoutine) ((WEStreamObjectUPP) (userRoutine))
  992.  
  993. #define CallWEClickLoopProc(hWE, userRoutine) \
  994.     (*(userRoutine))((hWE))
  995. #define CallWEScrollProc(hWE, userRoutine) \
  996.     (*(userRoutine))((hWE))
  997. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  998.     (*(userRoutine))((hWE))
  999. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  1000.     (*(userRoutine))((hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  1001. #define CallWETranslateDragProc(drag, dragItem, requestedType, putDataHere, dropOffset, hWE, userRoutine) \
  1002.     (*(userRoutine))((drag), (dragItem), (requestedType), (putDataHere), (dropOffset), (hWE))
  1003. #define CallWEHiliteDropAreaProc(drag, hiliteFlag, hWE, userRoutine) \
  1004.     (*(userRoutine))((drag), (hiliteFlag), (hWE))
  1005. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  1006.     (*(userRoutine))((fontID), (fontName))
  1007. #define CallWEFontNameToIDProc(fontName, oldFontID, fontID, userRoutine) \
  1008.     (*(userRoutine))((fontName), (oldFontID), (fontID))
  1009. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  1010.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (hWE))
  1011. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  1012.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  1013. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  1014.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  1015. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  1016.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  1017. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  1018.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  1019. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  1020.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  1021. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  1022.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  1023. #define CallWEEraseProc(area, hWE, userRoutine) \
  1024.     (*(userRoutine))((area), (hWE))
  1025. #define CallWEFluxProc(offset, delta, hWE, userRoutine) \
  1026.     (*(userRoutine))((offset), (delta), (hWE))
  1027. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) \
  1028.     (*(userRoutine))((defaultObjectSize), (hObjectDesc))
  1029. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) \
  1030.     (*(userRoutine))((hObjectDesc))
  1031. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) \
  1032.     (*(userRoutine))((destRect), (hObjectDesc))
  1033. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) \
  1034.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (hObjectDesc))
  1035. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) \
  1036.     (*(userRoutine))((destKind), (theType), (putDataHere), (hObjectDesc))
  1037.  
  1038. #endif
  1039.  
  1040. typedef Boolean (*WESegmentLoopProcPtr)
  1041.     (
  1042.         WELineRec *pLine,
  1043.         const WERunAttributes *pAttrs,
  1044.         Ptr pSegment,
  1045.         SInt32 segmentStart,
  1046.         SInt32 segmentLength,
  1047.         JustStyleCode styleRunPosition,
  1048.         WEHandle hWE,
  1049.         void *callbackData
  1050.     );
  1051.  
  1052. typedef FourCharCode WESelector;
  1053.  
  1054. typedef struct WEFieldDescriptor
  1055. {
  1056.     SInt16 fOffset;
  1057.     SInt16 fLength;
  1058. } WEFieldDescriptor;
  1059.  
  1060. typedef struct WELookupTable
  1061. {
  1062.     WESelector selector;
  1063.     WEFieldDescriptor desc;
  1064. } WELookupTable;
  1065.  
  1066. typedef struct WEUserInfoEntry
  1067. {
  1068.     WESelector tag;
  1069.     SInt32 info;
  1070. } WEUserInfoEntry;
  1071.  
  1072. typedef struct WEOHTableEntry
  1073. {
  1074.     FlavorType objectType;
  1075.     WENewObjectUPP newHandler;
  1076.     WEDisposeObjectUPP freeHandler;
  1077.     WEDrawObjectUPP drawHandler;
  1078.     WEClickObjectUPP clickHandler;
  1079.     WEStreamObjectUPP streamHandler;
  1080.     SInt32 refCon;
  1081. } WEOHTableEntry, **WEOHTableHandle;
  1082.  
  1083. typedef struct WEObjectDesc
  1084. {
  1085.     FlavorType objectType;                // 4-letter tag identifying object type
  1086.     Handle objectDataHandle;            // handle to object data
  1087.     Point objectSize;                    // object height and width, in pixels
  1088.     WEOHTableHandle objectTable;        // handle to object handler table
  1089.     SInt32 objectIndex;                    // index into object handler table
  1090.     WEHandle objectOwner;                // handle to owner WE instance
  1091.     SInt32 objectRefCon;                // free for use by object handlers
  1092. } WEObjectDesc;
  1093.  
  1094. typedef struct WERec
  1095. {
  1096.     GrafPtr port;                            // graphics port text is drawn into
  1097.     Handle hText;                            // handle to the text
  1098.     WELineArrayHandle hLines;                // handle to the line array
  1099.     WEStyleTableHandle hStyles;                // handle to the style table
  1100.     WERunArrayHandle hRuns;                    // handle to the style run array
  1101.     SInt32 textLength;                        // length of text
  1102.     SInt32 nLines;                            // number of lines
  1103.     SInt32 nStyles;                            // number of unique styles in the style table
  1104.     SInt32 nRuns;                            // number of style runs
  1105.     LongRect viewRect;                        // view rectangle, all drawing is clipped to this
  1106.     LongRect destRect;                        // destination rectangle
  1107.     SInt32 selStart;                        // start of selection range
  1108.     SInt32 selEnd;                            // end of selection range
  1109.     UInt32 flags;                            // 32 bits of miscellaneous flags (private)
  1110.     UInt32 features;                        // 32 bit of feature flags (public)
  1111.     UInt32 caretTime;                        // time of most recent caret drawing, in ticks
  1112.     UInt32 clickTime;                        // time of most recent click, in ticks
  1113.     SInt32 clickLoc;                        // byte offset of most recent click
  1114.     SInt32 anchorStart;                        // start offset of anchor word/line
  1115.     SInt32 anchorEnd;                        // end offset of anchor word/line
  1116.     char firstByte;                            // first byte of a double-byte character
  1117.     WEEdge clickEdge;                        // edge of character hit by most recent click
  1118.     UInt8 clickCount;                        // multiple click count
  1119.     WEAlignment alignment;                    // alignment style
  1120.     WEDirection direction;                    // dominant line direction
  1121.     SInt16 filler1;                            // unused
  1122.     GrafPtr offscreenPort;                    // offscreen graphics world
  1123.     RgnHandle viewRgn;                        // handle to the view region
  1124.     void *refCon;                            // reference value for client use
  1125.     Handle hUserInfo;                        // more junk for client use
  1126.     TSMDocumentID tsmReference;                // reference value for the text services manager
  1127.     SInt32 tsmAreaStart;                    // start of active input area (for TSM)
  1128.     SInt32 tsmAreaEnd;                        // end of active input area
  1129.     DragReference currentDrag;                // reference of drag being tracked by _WEDrag
  1130.     SInt32 dragCaretOffset;                    // offset to caret displayed during a drag
  1131.     WEActionHandle hActionStack;            // action stack for undo
  1132.     UInt32 modCount;                        // modification count
  1133.     WEClickLoopUPP clickLoop;                // click loop callback
  1134.     WEScrollUPP scrollProc;                    // scroll callback
  1135.     WETSMPreUpdateUPP tsmPreUpdate;            // TSM pre-update callback
  1136.     WETSMPostUpdateUPP tsmPostUpdate;        // TSM post-update callback
  1137.     WETranslateDragUPP translateDragHook;    // drag translation hook
  1138.     WEHiliteDropAreaUPP hiliteDropAreaHook;    // drop area highlighting hook
  1139.     WEDrawTextUPP drawTextHook;                // hook for drawing text
  1140.     WEPixelToCharUPP pixelToCharHook;        // hook for hit-testing
  1141.     WECharToPixelUPP charToPixelHook;        // hook for locating glyph position
  1142.     WELineBreakUPP lineBreakHook;            // hook for finding line breaks
  1143.     WEWordBreakUPP wordBreakHook;            // hook for finding word breaks
  1144.     WECharByteUPP charByteHook;                // hook for finding character byte type
  1145.     WECharTypeUPP charTypeHook;                // hook for finding character type
  1146.     WEEraseUPP eraseHook;                    // hook for erasing background
  1147.     WEFluxUPP fluxProc;                        // flux callback
  1148.     WERunAttributes nullStyle;                // style for null selection
  1149.     WEOHTableHandle hObjectHandlerTable;    // handle to object handler table for this instance
  1150.     SInt32 translucencyThreshold;            // use translucent drags unless selection area exceeds this
  1151.     StringHandle hURLHint;                    // hint string for slack URLs
  1152. } WERec;
  1153.  
  1154. struct SLDrawData
  1155. {
  1156.     GrafPtr screenPort;
  1157.     GDHandle screenDevice;
  1158.     PixMapHandle offscreenPixels;    // offscreen pixel map
  1159.     Rect bounds;                    // bounds of offscreen buffer, in global coords
  1160.     Rect lineRect;                    // rect enclosing current line
  1161.     Rect drawRect;                    // visible portion of line rect
  1162.     Boolean usingColor;                // true if drawing in color
  1163.     Boolean usingOffscreen;            // true if an offscreen graphics world has been set up
  1164.     Boolean drawingOffscreen;        // true if actually drawing to an offscreen buffer
  1165.     Boolean doErase;                // true if line rectangle should be erased before drawing
  1166. };
  1167.  
  1168. struct SLCalcSlopData
  1169. {
  1170.     SInt16 lineWidth;
  1171.     SInt16 totalSlop;
  1172.     Fixed totalProportion;
  1173. };
  1174.  
  1175. struct SLPixelToCharData
  1176. {
  1177.     Fixed hPos;
  1178.     Fixed pixelWidth;
  1179.     SInt32 offset;
  1180.     WEEdge edge;
  1181. };
  1182.  
  1183. struct SLCharToPixelData
  1184. {
  1185.     LongPt *thePoint;
  1186.     SInt32 offset;
  1187.     SInt16 direction;
  1188.     Boolean lineDir;    // is the line direction RL?
  1189.     Boolean rightEdge;    // are we getting the right edge of the line?
  1190. };
  1191.  
  1192. struct SLCollectHiliteRgnData
  1193. {
  1194.     SInt32 rangeStart;
  1195.     SInt32 rangeEnd;
  1196.     SInt16 hPos;
  1197. };
  1198.  
  1199. struct SLCrossDirectionBoundaryData
  1200. {
  1201.     SInt32 oldOffset;        //    offset before crossing direction boundary
  1202.     SInt32 newOffset;        //    offset after crossing direction boundary
  1203.     Boolean movingRight;    //    moving insertion point to the right?
  1204.     Boolean isDone;
  1205. };
  1206.  
  1207. struct FormatOrderData
  1208. {
  1209.     SInt32 firstRun;
  1210.     WEHandle hWE;
  1211. };
  1212.  
  1213. #if PRAGMA_ALIGN_SUPPORTED
  1214. #pragma options align=reset
  1215. #endif
  1216.  
  1217. #ifdef __cplusplus
  1218. extern "C" {
  1219. #endif
  1220.  
  1221. //    PUBLIC ROUTINES
  1222.  
  1223. //    WEAccessors.c (public)
  1224. pascal SInt32 WEOffsetToLine(SInt32 offset, WEHandle hWE);
  1225. pascal SInt32 WECountLines(WEHandle hWE);
  1226. pascal void WEGetLineRange(SInt32 lineIndex, SInt32 *lineStart, SInt32 *lineEnd, WEHandle hWE);
  1227. pascal SInt32 WEOffsetToRun (SInt32 offset, WEHandle hWE);
  1228. pascal SInt32 WECountRuns(WEHandle hWE);
  1229. pascal void WEGetRunRange(SInt32 runIndex, SInt32 *runStart, SInt32 *runEnd, WEHandle hWE);
  1230. pascal Boolean WEGetRunDirection(SInt32 offset, WEHandle hWE);
  1231. pascal void WEGetRunInfo(SInt32 offset, WERunInfo *info, WEHandle hWE);
  1232. pascal void WESetDestRect(const LongRect *destRect, WEHandle hWE);
  1233. pascal void WEGetDestRect(LongRect *destRect, WEHandle hWE);
  1234. pascal void WESetViewRect(const LongRect *viewRect, WEHandle hWE);
  1235. pascal void WEGetViewRect(LongRect *viewRect, WEHandle hWE);
  1236. pascal WEAlignment WEGetAlignment(WEHandle hWE);
  1237. pascal WEDirection WEGetDirection(WEHandle hWE);
  1238. pascal void WEGetSelection(SInt32 *selStart, SInt32 *selEnd, WEHandle hWE);
  1239. pascal SInt32 WEGetTextLength(WEHandle hWE);
  1240. pascal SInt32 WEGetHeight(SInt32 startLine, SInt32 endLine, WEHandle hWE);
  1241. pascal Handle WEGetText(WEHandle hWE);
  1242. pascal SInt16 WEGetChar(SInt32 offset, WEHandle hWE);
  1243. pascal SInt16 WEFeatureFlag(SInt16 feature, SInt16 action, WEHandle hWE);
  1244. pascal UInt32 WEVersion(void);
  1245.  
  1246. //    WEBirthDeath.c (public)
  1247. pascal OSErr WENew(const LongRect *destRect, const LongRect *viewRect, UInt32 features, WEHandle *hWE);
  1248. pascal void WEDispose(WEHandle hWE);
  1249. pascal OSErr WEUseText(Handle text, WEHandle hWE);
  1250.  
  1251. //    WEDrawing.c (public)
  1252. pascal OSErr WEGetSelectedObject(WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1253. pascal SInt32 WEFindNextObject(SInt32 offset, WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1254. pascal Boolean WEContinuousStyle(WEStyleMode *mode, TextStyle *ts, WEHandle hWE);
  1255.  
  1256. //    WEFontTables.c (public)
  1257. pascal OSErr WEBuildFontTable(Handle hFontTable, WEFontIDToNameUPP fontIDToNameProc, WEHandle hWE);
  1258. pascal OSErr WEUpdateFontTable(Handle hFontTable, WEFontNameToIDUPP fontNameToIDProc, Boolean *wasChanged);
  1259. pascal OSErr WEUpdateStyleScrap(StScrpHandle hStyles, Handle hFontTable);
  1260.  
  1261. //    WEHighLevelEditing.c (public)
  1262. pascal OSErr WEUndo(WEHandle hWE);
  1263. pascal void WEClearUndo(WEHandle hWE);
  1264. pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEHandle hWE);
  1265. pascal OSErr WEBeginAction(WEHandle hWE);
  1266. pascal OSErr WEEndAction(WEActionKind actionKind, WEHandle hWE);
  1267. pascal UInt32 WEGetModCount(WEHandle hWE);
  1268. pascal void WEResetModCount(WEHandle hWE);
  1269. pascal Boolean WEIsTyping(WEHandle hWE);
  1270. pascal void WEKey(SInt16 key, EventModifiers modifiers, WEHandle hWE);
  1271. pascal OSErr WEInsert(Ptr textPtr, SInt32 textLength, StScrpHandle hStyles, Handle hSoup, WEHandle hWE);
  1272. pascal OSErr WEInsertObject(FlavorType objectType, Handle objectDataHandle, Point objectSize, WEHandle hWE);
  1273. pascal OSErr WEDelete(WEHandle hWE);
  1274. pascal OSErr WECut(WEHandle hWE);
  1275. pascal Boolean WECanPaste(WEHandle hWE);
  1276. pascal OSErr WEPaste(WEHandle hWE);
  1277. pascal OSErr WESetStyle(WEStyleMode mode, const TextStyle *ts, WEHandle hWE);
  1278. pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEHandle hWE);
  1279. pascal OSErr WEUseSoup(Handle hSoup, WEHandle hWE);
  1280.  
  1281. //    WEInlineInput.c (public)
  1282. pascal OSErr WEInstallTSMHandlers(void);
  1283. pascal OSErr WERemoveTSMHandlers(void);
  1284. pascal OSErr WEHandleTSMEvent(const AppleEvent *ae, AppleEvent *reply);
  1285. pascal void WEStopInlineSession(WEHandle hWE);
  1286.  
  1287. //    WELineLayout (public)
  1288. pascal OSErr WECalText(WEHandle hWE);
  1289. pascal void WESetAlignment(WEAlignment alignment, WEHandle hWE);
  1290. pascal void WESetDirection(WEDirection direction, WEHandle hWE);
  1291.  
  1292. //    WELongCoords.c (public)
  1293. pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  1294. pascal void WEPointToLongPoint(Point p, LongPt *lp);
  1295. pascal void WESetLongRect(LongRect *lr, SInt32 left, SInt32 top, SInt32 right, SInt32 bottom);
  1296. pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  1297. pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  1298. pascal void WEOffsetLongRect(LongRect *lr, SInt32 hOffset, SInt32 vOffset);
  1299. pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  1300.  
  1301. //    WEMouse.c (public)
  1302. pascal Boolean WECanAcceptDrag(DragReference drag, WEHandle hWE);
  1303. pascal OSErr WETrackDrag(DragTrackingMessage message, DragReference drag,
  1304.                                     WEHandle hWE);
  1305. pascal OSErr WEReceiveDrag(DragReference drag, WEHandle hWE);
  1306. pascal Boolean WEDraggedToTrash(DragReference drag);
  1307. pascal void WEClick(Point mouseLoc, EventModifiers modifiers, UInt32 clickTime, WEHandle hWE);
  1308. pascal UInt16 WEGetClickCount(WEHandle hWE);
  1309.  
  1310. //    WEObjects.c (public)
  1311. pascal FlavorType WEGetObjectType(WEObjectDescHandle hObjectDesc);
  1312. pascal Handle WEGetObjectDataHandle(WEObjectDescHandle hObjectDesc);
  1313. pascal Point WEGetObjectSize(WEObjectDescHandle hObjectDesc);
  1314. pascal WEHandle WEGetObjectOwner(WEObjectDescHandle hObjectDesc);
  1315. pascal SInt32 WEGetObjectRefCon(WEObjectDescHandle hObjectDesc);
  1316. pascal void WESetObjectRefCon(WEObjectDescHandle hObjectDesc, SInt32 refCon);
  1317. pascal OSErr WEInstallObjectHandler(FlavorType objectType, WESelector handlerSelector,
  1318.                 UniversalProcPtr handler, WEHandle hWE);
  1319. pascal OSErr WEGetObjectHandler(FlavorType objectType, WESelector handlerSelector,
  1320.                 UniversalProcPtr *handler, WEHandle hWE);
  1321.  
  1322. //    WEScraps.c (public)
  1323. pascal OSErr WECopyRange(SInt32 rangeStart, SInt32 rangeEnd, Handle hText, Handle
  1324.                     hStyles, Handle hSoup, WEHandle hWE);
  1325. pascal OSErr WECopy(WEHandle hWE);
  1326.  
  1327. //    WESelecting.c (public)
  1328. pascal SInt32 WEGetOffset(const LongPt *thePoint, WEEdge *edge, WEHandle hWE);
  1329. pascal void WEGetPoint(SInt32 offset, SInt16 direction, LongPt *thePoint, SInt16 *lineHeight, WEHandle hWE);
  1330. pascal void WEFindWord(SInt32 offset, WEEdge edge, SInt32 *wordStart, SInt32 *wordEnd, WEHandle hWE);
  1331. pascal void WEFindLine(SInt32 offset, WEEdge edge, SInt32 *lineStart, SInt32 *lineEnd, WEHandle hWE);
  1332. pascal void WEFindParagraph(SInt32 offset, WEEdge edge, SInt32 *paragraphStart, SInt32 *paragraphEnd, WEHandle hWE);
  1333. pascal SInt16 WECharByte(SInt32 offset, WEHandle hWE);
  1334. pascal SInt16 WECharType(SInt32 offset, WEHandle hWE);
  1335. pascal RgnHandle WEGetHiliteRgn(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1336. pascal void WESetSelection(SInt32 selStart, SInt32 selEnd, WEHandle hWE);
  1337. pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEHandle hWE);
  1338. pascal void WEIdle(UInt32 *maxSleep, WEHandle hWE);
  1339. pascal void WEUpdate(RgnHandle updateRgn, WEHandle hWE);
  1340. pascal void WEDeactivate(WEHandle hWE);
  1341. pascal void WEActivate(WEHandle hWE);
  1342. pascal Boolean WEIsActive(WEHandle hWE);
  1343. pascal void WEScroll(SInt32 hOffset, SInt32 vOffset, WEHandle hWE);
  1344. pascal void WEPinScroll(SInt32 hOffset, SInt32 vOffset, WEHandle hWE);
  1345. pascal void WESelView(WEHandle hWE);
  1346.  
  1347. //    WESelectors.c (public)
  1348. pascal OSErr WEGetInfo(WESelector selector, void *info, WEHandle hWE);
  1349. pascal OSErr WESetInfo(WESelector selector, const void *info, WEHandle hWE);
  1350.  
  1351. //    WEUserSelectors.c (public)
  1352. pascal OSErr WEGetUserInfo(WESelector tag, SInt32 *userInfo, WEHandle hWE);
  1353. pascal OSErr WESetUserInfo(WESelector tag, SInt32 userInfo, WEHandle hWE);
  1354.  
  1355. //    WESharedLibrary.c
  1356. pascal OSErr _WECFMInitialize(const CFragInitBlock *theInitBlock);
  1357. pascal void _WECFMTerminate(void);
  1358.  
  1359.  
  1360. //    PRIVATE ROUTINES
  1361.  
  1362. //    These routines should be eligible to be tagged "internal" when
  1363. //    building a CFM shared library: they should never be exported
  1364. //    (listed in the .exp file) and their address should never be passed
  1365. //    to an external fragment.
  1366.  
  1367. #if WASTE_SHARED_LIBRARY
  1368. #pragma internal on
  1369. #endif
  1370.  
  1371. //    WEAccessors.c (private)
  1372. pascal SInt32 _WEPixelToLine(SInt32 vOffset, WEHandle hWE);
  1373. pascal void _WEGetIndStyle(SInt32 runIndex, WERunInfo *info, WEHandle hWE);
  1374. pascal Boolean _WEGetIndDirection(SInt32 runIndex, WEHandle hWE);
  1375.  
  1376. //    WEBirthDeath.c (private)
  1377. extern const Point kOneToOneScaling;
  1378. pascal void _WEResetStyleTable(WEHandle hWE);
  1379. pascal OSErr _WERegisterWithTSM(WEHandle hWE);
  1380. pascal void _WESetStandardHooks(WEHandle hWE);
  1381. pascal SInt16 _WEScriptToFont(ScriptCode script);
  1382.  
  1383. //    WEDebug.c (private)
  1384. pascal void _WESanityCheck(WEHandle hWE);
  1385.  
  1386. //    WEDrawing.c (private)
  1387. pascal void _WEContinuousStyleRange(SInt32 rangeStart, SInt32 rangeEnd,
  1388.         WEStyleMode *mode, WETextStyle *ts, WEHandle hWE);
  1389. pascal void _WESynchNullStyle(WEHandle hWE);
  1390. pascal void _WESegmentLoop(SInt32 firstLine, SInt32 lastLine, WESegmentLoopProcPtr callback, void *callbackData, WEHandle hWE);
  1391. pascal void _WEDrawTSMHilite(Rect *segmentRect, UInt8 tsFlags);
  1392. pascal void _WEDrawLines (SInt32 firstLine, SInt32 lastLine, Boolean doErase, WEHandle hWE);
  1393. pascal SInt16 _WECalcPenIndent(const WELineRec * pLine, WEAlignment alignment, WEDirection direction);
  1394. pascal void _WESaveQDEnvironment(GrafPtr port, Boolean saveColor, QDEnvironment *environment);
  1395. pascal void _WERestoreQDEnvironment(const QDEnvironment *environment);
  1396. pascal void _WEFillFontInfo (GrafPtr port, WERunAttributes *targetStyle);
  1397. pascal void _WECopyStyle (const WETextStyle *sourceStyle, WETextStyle *targetStyle,
  1398.         Style offStyles, WEStyleMode mode);
  1399. pascal Boolean _WEOffsetInRange(SInt32 offset, WEEdge edge, SInt32 rangeStart, SInt32 rangeEnd);
  1400.  
  1401. //    WEHighLevelEditing.c (private)
  1402. pascal void _WEPushAction(WEActionHandle hAction);
  1403. pascal OSErr _WENewAction(SInt32 rangeStart, SInt32 rangeEnd, SInt32 newTextLength,
  1404.                             WEActionKind actionKind, WEActionFlags actionFlags,
  1405.                             WEHandle hWE, WEActionHandle *hAction);
  1406. pascal void _WEDisposeAction(WEActionHandle hAction);
  1407. pascal void _WEForgetAction(WEActionHandle *hAction);
  1408. pascal OSErr _WEDoAction(WEActionHandle hAction);
  1409. pascal void _WEAdjustUndoRange(SInt32 moreBytes, WEHandle hWE);
  1410. pascal OSErr _WETypeChar(char theByte, WEHandle hWE);
  1411. pascal OSErr _WEBackspace(WEHandle hWE);
  1412. pascal OSErr _WEForwardDelete(WEHandle hWE);
  1413. pascal OSErr _WESmartSetFont(WEStyleMode mode, const TextStyle *ts, WEHandle hWE);
  1414.  
  1415. //    WEInlineInput.c (private)
  1416. pascal OSErr _WEHiliteRangeArray(TextRangeArrayHandle hTray, WEHandle hWE);
  1417.  
  1418. //    WELineLayout.c (private)
  1419. pascal void _WERemoveLine(SInt32 lineIndex, WEPtr pWE);
  1420. pascal OSErr _WEInsertLine(SInt32 lineIndex, const WELineRec *pLine, WEPtr pWE);
  1421. pascal void _WEBumpOrigin(SInt32 lineIndex, SInt32 deltaOrigin, WEPtr pWE);
  1422. pascal SInt32 _WEFindLineBreak(SInt32 lineStart, WEHandle hWE);
  1423. pascal void _WECalcHeights(SInt32 rangeStart, SInt32 rangeEnd, SInt16 *lineAscent, SInt16 *lineDescent,
  1424.         WEHandle hWE);
  1425. pascal OSErr _WERecalBreaks(SInt32 *startLine, SInt32 *endLine, WEHandle hWE);
  1426. pascal void _WERecalSlops(SInt32 firstLine, SInt32 lastLine, WEHandle hWE);
  1427.  
  1428. //    WELowLevelEditing.c (private)
  1429. pascal Boolean _WEIsWordRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1430. pascal Boolean _WEIsPunct(SInt32 offset, WEHandle hWE);
  1431. pascal void _WEIntelligentCut(SInt32 *rangeStart, SInt32 *rangeEnd, WEHandle hWE);
  1432. pascal SInt16 _WEIntelligentPaste(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1433. pascal OSErr _WEInsertRun(SInt32 runIndex, SInt32 offset, SInt32 styleIndex, WEPtr pWE);
  1434. pascal void _WERemoveRun(SInt32 runIndex, WEPtr pWE);
  1435. pascal void _WEChangeRun(SInt32 runIndex, SInt32 newStyleIndex, Boolean keepOld, WEPtr pWE);
  1436. pascal OSErr _WENewStyle(const WETextStyle *ts, SInt32 *styleIndex, WEPtr pWE);
  1437. pascal OSErr _WERedraw(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1438. pascal OSErr _WESetStyleRange(SInt32 rangeStart, SInt32 rangeEnd, WEStyleMode mode,
  1439.                 const WETextStyle *ts, WEHandle hWE);
  1440. pascal OSErr _WEApplyStyleScrap(SInt32 rangeStart, SInt32 rangeEnd, StScrpHandle styleScrap, WEHandle hWE);
  1441. pascal OSErr _WEApplySoup(SInt32 offset, Handle hSoup, WEHandle hWE);
  1442. pascal void _WEBumpRunStart(SInt32 runIndex, SInt32 deltaRunStart, WEPtr pWE);
  1443. pascal void _WERemoveRunRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1444. pascal void _WEBumpLineStart(SInt32 lineIndex, SInt32 deltaLineStart, WEPtr pWE);
  1445. pascal void _WERemoveLineRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1446. pascal OSErr _WEDeleteRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1447. pascal OSErr _WEInsertText(SInt32 offset, Ptr textPtr, SInt32 textLength, WEHandle hWE);
  1448.  
  1449. //    WELongCoords (private)
  1450. pascal SInt32 _WEPinInRange(SInt32 value, SInt32 rangeStart, SInt32 rangeEnd);
  1451.  
  1452. //    WEMouse.c (private)
  1453. pascal Boolean _WEIsOptionDrag(DragReference drag);
  1454. pascal OSErr _WEGetFlavor(DragReference drag, ItemReference dragItem,
  1455.                 FlavorType requestedType, Handle hFlavor,
  1456.                 SInt32 dropOffset, WEHandle hWE);
  1457. pascal OSErr _WEExtractFlavor(DragReference drag, ItemReference dragItem,
  1458.                         FlavorType theType, Handle *hFlavor,
  1459.                         SInt32 dropOffset, WEHandle hWE);
  1460. pascal void _WEUpdateDragCaret(SInt32 offset, WEHandle hWE);
  1461. pascal RgnHandle _WEOutlineRgn(RgnHandle solidRgn);
  1462. pascal OSErr _WEMakeDragImage(GWorldPtr *imageGWorld, RgnHandle *imageRgn, WEHandle hWE);
  1463. pascal OSErr _WEDrag(Point mouseLoc, EventModifiers modifiers, UInt32 clickTime, WEHandle hWE);
  1464. pascal void _WEResolveURL(EventModifiers modifiers, SInt32 urlStart, SInt32 urlEnd, WEHandle hWE);
  1465.  
  1466. //    WEObjects.c (private)
  1467. pascal SInt32 _WELookupObjectType(FlavorType objectType, WEOHTableHandle hTable);
  1468. pascal OSErr _WEGetIndObjectType(SInt32 index, FlavorType *objectType, WEHandle hWE);
  1469. pascal OSErr _WENewObject(FlavorType objectType, Handle objectDataHandle, WEHandle hWE,
  1470.                     WEObjectDescHandle *hObjectDesc);
  1471. pascal OSErr _WEFreeObject(WEObjectDescHandle hObjectDesc);
  1472. pascal OSErr _WEDrawObject(WEObjectDescHandle hObjectDesc);
  1473. pascal Boolean _WEClickObject(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  1474.                                 WEObjectDescHandle hObjectDesc);
  1475. pascal OSErr _WEStreamObject(SInt16 destKind, FlavorType *theType, Handle *theData,
  1476.                 Boolean *canDisposeData, WEObjectDescHandle hObjectDesc);
  1477.  
  1478. //    WEScraps.c (private)
  1479. pascal OSErr _WEPrependStyle(Handle hStyleScrap, const WERunInfo *info, SInt32 offsetDelta);
  1480. pascal OSErr _WEAppendStyle(Handle hStyleScrap, const WERunInfo *info, SInt32 offset);
  1481. pascal OSErr _WEPrependObject(Handle hSoup, const WERunInfo *info, SInt32 offsetDelta);
  1482. pascal OSErr _WEAppendObject(Handle hSoup, const WERunInfo *info, SInt32 offset);
  1483.  
  1484. //    WESelecting.c (private)
  1485. pascal void _WEClearHiliteBit(void);
  1486. pascal SInt16 _WEGetContext(SInt32 offset, SInt32 *contextStart, SInt32 *contextEnd,
  1487.                         WEHandle hWE);
  1488. pascal SInt16 _WEGetRestrictedContext(SInt32 offset, SInt32 *contextStart, SInt32 *contextEnd,
  1489.                         WEHandle hWE);
  1490. pascal void _WEGetCaretRect(SInt32 offset, SInt16 direction, Rect *caretRect, WEHandle hWE);
  1491. pascal void _WEDrawCaret(SInt32 offset, SInt16 direction, Boolean useDualCaret, WEHandle hWE);
  1492. pascal void _WEBlinkCaret(WEHandle hWE);
  1493. pascal void _WEHiliteRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1494. pascal SInt32 _WECrossDirectionBoundary(SInt32 offset, Boolean movingRight, WEHandle hWE);
  1495. pascal SInt32 _WEArrowOffset(SInt16 action, SInt32 offset, WEHandle hWE);
  1496. pascal void _WEDoArrowKey (SInt16 arrow, EventModifiers modifiers, WEHandle hWE);
  1497. pascal Boolean _WEScrollIntoView (SInt32 offset, WEHandle hWE);
  1498.  
  1499. // WESelectors.c (private)
  1500. extern WELookupTable _weMainSelectorTable[];
  1501. extern WELookupTable _weObjectHandlerSelectorTable[];
  1502. pascal void _WELookupSelector(const WELookupTable *table, WESelector selector, WEFieldDescriptor *desc);
  1503. pascal OSErr _WEGetField(const WELookupTable *table, WESelector selector, SInt32 *info, void *structure);
  1504. pascal OSErr _WESetField(const WELookupTable *table, WESelector selector, SInt32 *info, void *structure);
  1505.  
  1506. // WEUtilities.c (private)
  1507. pascal void _WEForgetHandle(Handle *h);
  1508. pascal Boolean _WESetHandleLock(Handle h, Boolean lock);
  1509. pascal void _WEBlockClr(void *block, Size blockSize);
  1510. pascal Boolean _WEBlockCmp(const void *block1, const void *block2, Size blockSize);
  1511. pascal void _WEReorder(SInt32 *a, SInt32 *b);
  1512. pascal OSErr _WEAllocate(Size blockSize, UInt32 allocFlags, Handle *h);
  1513. pascal OSErr _WESplice(Handle h, const void *blockPtr, SInt32 blockSize, SInt32 offset);
  1514.  
  1515. #if WASTE_SHARED_LIBRARY
  1516. #pragma internal reset
  1517. #endif
  1518.  
  1519. #ifdef __cplusplus
  1520. }
  1521. #endif
  1522.